#include "KohonenNetwork.h"

using namespace NeuralPlusPlus::Core;
using namespace NeuralPlusPlus::Core::SOM;

PositionNeuron* NeuralPlusPlus::Core::SOM::KohonenNetwork::Winner()
	{
	return ((KohonenLayer*)outputLayer)->winner;
	}

NeuralPlusPlus::Core::SOM::KohonenNetwork::KohonenNetwork( KohonenLayer *inputLayer, KohonenLayer *outputLayer ) : Network(inputLayer, outputLayer, TrainingMethodType::Unsupervised)
	{

	}

void NeuralPlusPlus::Core::SOM::KohonenNetwork::LearnSample( TrainingSample *trainingSample, int currentIteration, int trainingEpochs )
	{
	// No validation here
	int layerCount = layers.size();
	inputLayer->SetInput(trainingSample->InputVector);
	for(int i=0;i<layerCount;i++)
		{
		layers[i]->Run();
		layers[i]->Learn(currentIteration,trainingEpochs);
		}
	}